﻿using Md.Api.Entity.DapperModels.MdDB;
using Md.Api.Model.Manage.MdUser.Request;
using Md.Dapper.Repositories.Md;

namespace Md.Api.Service.Manage.MdUser;
/// <summary>
/// 获取用户列表服务
/// </summary>
public class GetMdUserListService : ApiBase<RequestGetMdUserListModel>
{
    /// <summary>
    /// 用户仓储
    /// </summary>
    public MdUserRep mdUserRep { get; set; }
    /// <summary>
    /// 执行
    /// </summary>
    protected override void ExecuteMethod()
    {
        var model = new MdUserModel();

        model.UserName = Parameter.UserName;
        model.UserNick = Parameter.UserNick;
        model.UserType = Parameter.UserType;
        model.DeptId = Parameter.DeptId;
        model.RoleId = Parameter.RoleId;
        model.PostId = Parameter.PostId;
        model.Sex = Parameter.Sex;
        model.Email = Parameter.Email;
        model.Phone = Parameter.Phone;
        model.OnLine = Parameter.OnLine;
        model.Status = Parameter.Status;
        model.CreateBy = Parameter.CreateBy;
        model.UpdateBy = Parameter.UpdateBy;
        model.OpenId = Parameter.OpenId;

        var res = mdUserRep.GetMdUserList(model, Parameter.OrderBy, Parameter.IsDesc);

        Result.Data = res;
    }
}

